Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config] prevents registering defaults for reserved identifiers #6459

Open
wants to merge 4 commits into
base: V3/develop
Choose a base branch
from

Conversation

Chovin
Copy link

@Chovin Chovin commented Oct 1, 2024

Description of the changes

Fixes #6290 by raising a RuntimeError when registering config with an identifier that's already in Config/Group/Value objects

It does so using __slots__, so that changes the behavior of Config objects in that you can't set arbitrary attributes to them anymore. If that's a problem, we can add __dict__ to its __slots__ just like I do to Value. I went ahead and added it in case cog creators had set attributes on config

I don't believe using __slots__ to solve this presents any other complications, but perhaps this should be solved another way (like using class attributes). Let me know and I can adjust

Have the changes in this PR been tested?

Yes, at least through tox with a new test added, and the most common case "default"

@github-actions github-actions bot added the Category: Core - API - Config This is related to the `redbot.core.config` module and `redbot.core.drivers` package. label Oct 1, 2024
@Kreusada Kreusada added the Type: Enhancement Something meant to enhance existing Red features. label Oct 18, 2024
@Kreusada Kreusada self-assigned this Oct 18, 2024
@Kreusada Kreusada added this to the 3.5.14 milestone Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core - API - Config This is related to the `redbot.core.config` module and `redbot.core.drivers` package. Type: Enhancement Something meant to enhance existing Red features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Config] Prevent registering defaults for inaccessible identifiers
2 participants